package com.etb.wisdom.eframe.framework.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

import com.etb.core.utils.JsonUtil;
import com.etb.web.action.ETBAction;
import com.etb.web.utils.WebUtil;
import com.etb.wisdom.eframe.framework.service.AppApplicationService;
import com.etb.wisdom.eframe.model.AppApplication;

@Action("app")
@Namespace("/eframe/framework/application")
public class AppApplicationAction extends ETBAction<AppApplication> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4005825272072620735L;

	@Autowired
	public AppApplicationService appService;

	public void getTreedata() {
		String id = request.getParameter("id");
		String nodeType = request.getParameter("nodeType");
		WebUtil.render(JsonUtil.toJSONArray(appService.getTreenode(id, nodeType)).toString());
	}
	
	public void getFuncTreedata() {
		String id = request.getParameter("id");
		String nodeType = request.getParameter("nodeType");
		String value = request.getParameter("value");
		WebUtil.render(JsonUtil.toJSONArray(appService.getFuncTreenode(id, nodeType, value)).toString());
	}
	
	public void getAuth() {
		String roleId = request.getParameter("roleId");
		WebUtil.render(JsonUtil.toJSONArray(appService.getAuth(roleId)).toString());
	}
}